<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>set_diario</title>
    <link rel="stylesheet" href="../../css/base.css">
    <link rel="stylesheet" href="../../css/fy/set_diario.css">
</head>

<body>
    <div class="wrap">

        <!-- 头 -->
        <div class="parcel">
            <header>
                <div class="concent">
                    <div class="logo">
                        <a class="sub_log" href="/">胶囊日记</a>
                    </div>
                    <ul class="nav">
                        <li>
                            <a href="../ys/index.html">首页</a>
                        </li>
                        <li>
                            <a href="../zy/guanzhugeren1.html">关注</a>
                        </li>
                        <li>
                            <a href="/">话题</a>
                        </li>
                        <li>
                            <a href="/"><span>App</span>下载</a>
                        </li>
                    </ul>
                </div>

                <div class="sub_nav">

                    <div class="see new_write">
                        <a class="writeDiary" href="./text _diary.html">写日记</a>
                        <div class="color"></div>
                    </div>

                    <div class="set alert">
                        <a href="/">提醒(0)<span>▼</span></a>
                        <div class="alert_matter">
                            <div class="matter"></div>
                            <div class="sub_matter">
                                <span>没有提醒</span>
                            </div>
                        </div>

                    </div>


                    <div class="set auto">
                        <div class="userName">
                            <span class="mingzi"></span>
                            ▼
                        </div>
                        <div class="auto_sort">
                            <div class="sort"></div>
                            <div class="sub_sort">
                                <a href="/">我的日记</a>
                                <a href="/">我关注的人</a>
                                <a href="../../html/fy/set_message.html">设置</a>
                                <a href="/">退出</a>
                            </div>
                        </div>
                    </div>

                </div>


            </header>
        </div>
        <div class="top"></div>

        <!-- 主体 -->
        <div class="main">
            <!-- 个人信息 导航 -->
            <ul class="message">
                <li>
                    创建日记本
                </li>
            </ul>


            <div class="prompt">主题 必须填写.</div>
            <div class="sub_main">

                <!-- 内容更改 -->
                <div class="sub_message">
                    <div class="motif">
                        <span class="sub_motif">主题</span>
                        <input type="text" class="input">
                    </div>

                    <div class="describe">
                        <span class="sub_describe">描述</span>
                        <textarea name="" id="text" cols="30" rows="10"></textarea>
                    </div>

                    <div class="date_time">
                        <span class="sub_time">过期时间</span>
                        <div class="time">
                            <input id="date" name="date" type="date" />
                            <div class="sub_date">
                                <span class="dates">这是什么</span>
                                <p class="write">
                                    给日记本设置一个完结日期，日记本完结后你才能浏览该日记本的所有日记，在此之前，每天凌晨零点，你写的日记将被隐藏，包括你自己在内任何人都无法浏览。
                                </p>
                            </div>
                        </div>
                    </div>

                    <div class="diarySurvey">
                        <span class="permission">谁可以看到这个日记本？</span>
                        <select id="group" value="1">
                            <option value="1">大家</option>
                            <option value="2">我自己</option>
                        </select>
                    </div>

                    <div class="bth">
                        <!-- <button class="keep">
                            <button class="save">创建日记本</button>
                            <a class="save" href="../../html/fy/typeid.html">创建日记本</a>
                        </button>
                        <button> -->
                        <button class="save">创建日记本</button>
                        <a class="write_off" href="../../html/lk/my-diary.html">取消</a>
                        </button>
                    </div>

                </div>


                <div class="contents">
                    <span class="title">什么是胶囊日记？</span>
                    <p class="sub_title">
                        <span>胶囊日记</span>是一个记录生活的日记本。
                    </p>
                    <p class="article">首先你需要建立一个胶囊日记本，公开或是私密，并为它设定一个期限，这个期限决定了这个日记本的“厚度”，然后你就可以开始写日记了。
                        你可以在上面记录喜悦，悲伤，发牢骚，流水账，甚至只是一张相片，一条电话号码。
                        之后你会发现，<span>一觉醒来，前一天你和所有人的日记都不见了</span>，放心，它们并没有被删除，只是存放在你建好的日记本里， 等到日记本“写满”那天，你所有的日记就都可以再次被浏览。
                    </p>
                    <p class="tag">我们欢迎真实生活的记录，欢迎心血来潮，不鼓励转载，不鼓励冲动灌水。</p>
                </div>
            </div>
        </div>

        <!-- 底 -->
        <div class="sole">
            <footer>
                <ul class="about_us">
                    <li>
                        <p>© 2009－2022</p>
                        <a class="timep" href="/">timepill.net</a>
                        <span>|</span>
                    </li>
                    <li>
                        <a href="/">沪ICP备18006482号-1</a>
                        <span>|</span>
                    </li>
                    <li>
                        <a href="/">常见问题</a>
                        <span>|</span>
                    </li>
                    <li>
                        <a href="/">捐助胶囊</a>
                        <span>|</span>
                    </li>
                    <li>
                        <p class="about">联系我们:mx1700@gmail.com</p>
                    </li>
                </ul>


                <ul class="rendered">
                    <li>
                        <a href="/">图片存储由又拍云存储提供</a>
                        <span>|</span>
                    </li>
                    <li>
                        <p>rendered in 0.0034 s</p>
                    </li>
                </ul>
            </footer>

        </div>
    </div>
</body>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="../../js/requestPre.js"></script>
<script>
<<<<<<< HEAD
    let inputEl = document.querySelector('.input')
    let saveBth = document.querySelector('.save')
    let textEl = document.querySelector('#text')
    let dateEl = document.querySelector('#date')
    // let prompt = document.querySelector('.prompt')

    let user = localStorage.user && JSON.parse(localStorage.user)
    // console.log(user);

    //   用户名获取
    let mingZi = document.querySelector('.mingzi')
    headUserName()
    async function headUserName() {

=======
    
    let saveBth = document.querySelector('.save');
    // let prompt = document.querySelector('.prompt')

    saveBth.addEventListener('click', createDiary)
    async function createDiary() {
        let inputEl = document.querySelector('.input');
        let description = document.querySelector("#text");
        let date = document.querySelector("#date");

        if (!inputEl.value) {
            return alert('主题必须填写')
        }
>>>>>>> 096bacc8c8ec486a8690e4749be02e8a4d1777c8
        let res = await axios({
            method: 'GET',
            url: '/api/user',
            params: {
                userId: user.userId,
            }
        })
        let html = ''
        html += `
                ${res.data.data.username} 
            `
        mingZi.innerHTML = html
    }


    saveBth.addEventListener('click', createDiary)

    function createDiary() {
        if (!inputEl.value || !textEl.value || !dateEl.value) {
            return alert('请填写必填内容')
        } else {
            location.href = '../lk/my-diary.html'
        }
    }

</script>

</html>